# # 计算字符串长度
# def my_len(s):
#     cnt = 0
#     for i in s:
#         cnt += 1
#     return cnt
#
# len = my_len(input("请输入一个字符串"))
# print(len)


# # 加法运算
# def add(x, y):
#     res = x + y
#     print(f"{x}+{y}={res}")
#
# add(int(input("x=")), int(input("y=")))


# # 判断体温
# def check_temperature(num):
#     if 36<=num<37.5:
#         print("体温正常")
#     elif num<36:
#         print("低温症")
#     else:
#         print("发烧")
#
# check_temperature(float(input("请输入体温：")))


# ATM

def query():
    print(f"余额：{money}")


def deposit():
    global money
    money += int(input("请输入存款金额："))


def withdrawal():
    global money
    tmp = int(input("请输入存款金额："))
    while tmp > money:
        print(f"余额不足！您的余额为：{money}")
        tmp = int(input("请重新输入取款金额："))
    money -= tmp


def menu():
    while 1:
        print("〓〓〓〓欢迎使用ATM〓〓〓〓")
        print("       1. 查询余额")
        print("       2. 存款")
        print("       3. 取款")
        print("       0. 退出")
        print()
        operate = int(input("请输入所需要的服务："))
        if operate == 1:
            query()
            continue
        elif operate == 2:
            deposit()
        elif operate == 3:
            withdrawal()
        elif operate == 0:
            break
        else:
            print("输入错误，请重新输入")
            continue
        print(f"操作成功！您当前余额为：{money}")


money = 10000
name = "Eclips3"

menu()